# pip install pymongo==3.9
# pip install pymongo==4.6.3
# python 11
from pymongo import MongoClient

#  创建数据库连接对象
client = MongoClient('mongodb://tasks:admin123456!@localhost:27017/tasks')

#  选择一个集合,没有的话会新建的 tasks为数据库， test1为集合
task_db = client['tasks']
col = task_db['test1']
query = {"1":"1"}
query_data = col.insert_one(query)
query_data2 = col.find_one(query)
print(query_data2)
for doc in col.find():
    print(doc)